package lab02.test22;

/**
 * Created by lenovo on 2017/10/31.
 */
public class Test {
    public static void main(String[] args) {
        //给定一个字符串，
        // 将字符串中的所有大写字母变成小写字母，
        // 数字用0 来代替，其他符号用#代替
        String results = "Hello,2018,The new year!";
        //hello#0000#the#new#year#
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < results.length(); i++) {
            char tmp = results.charAt(i);
            if (tmp >= 'A' && tmp <= 'Z') {
                // 追加
                stringBuffer.append((char) (tmp + 32));
            } else if (tmp >= 'a' && tmp <= 'z') {
                stringBuffer.append(tmp);
            } else if (tmp >= '0' && tmp <= '9') {
                stringBuffer.append("0");
            } else {
                stringBuffer.append("#");
            }
        }
        System.out.println(stringBuffer.toString());
    }
}
